package com.行为型模型.O命令模式;

import java.util.ArrayList;
import java.util.List;

/**
 * 服务员类
 */
public class Waitor {

    private List<Command> commandList;

    public void setCommand(Command command) {
        this.commandList.add(command);
    }

    public Waitor() {
        this.commandList = new ArrayList<>();
    }
    // 发出命令 喊 订单来了，厨师开始执行
    public void orderUp(){
        System.out.println("美女服务员：叮咚，大厨 来活了" );
        commandList.stream().forEach(e-> e.execute());

    }
}
